package com.linkage.usercenter.feign;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

/* *
 * @describe:  类型描述  三网运营商手机携号转网归属地实时查询
 * @author shaofeng.cheng
 * @title https://way.jd.com/hangzhoushumaikeji/mobile_transfer?mobile=13327458549&appkey=1e83739fc410e65e1374b02d61aad36c
 * @param
 * @return
 * @version: V1.0
 */
@FeignClient(name = "cclaim-phone-server",url="${customer.third-platform-config.third-phone-url}", fallback = PhoneManageFeign.PhoneManageFeignFallback.class)
public interface PhoneManageFeign {

    /**
     * 三网运营商手机携号转网归属地实时查询
     * @param mobile
     * @param appkey
     * @return
     */
    @GetMapping(value = "/mobile_transfer")
     public String mobileTransfer(@RequestParam(value = "mobile") String mobile, @RequestParam(value = "appkey") String appkey);


    @Component
    class PhoneManageFeignFallback implements PhoneManageFeign {

        private final Logger logger = LoggerFactory.getLogger(this.getClass());

        @Override
        public String mobileTransfer(String mobile, String appkey) {
            logger.error("三网运营商手机携号转网归属地实时查询失败！");
            return null;
        }
    }
}